<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.io.InputStreamReader,java.io.IOException,java.io.PrintWriter,java.sql.ResultSet,
java.util.ArrayList,javax.servlet.ServletException,javax.servlet.annotation.WebServlet,javax.servlet.http.HttpServlet,

javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse,org.apache.log4j.Logger,com.grantha.util.DB,com.mysql.jdbc.Connection
,com.mysql.jdbc.PreparedStatement" %>
<!DOCTYPE html>
<html>
<head>
<jsp:include page="/jsp/header.jsp" />
<title>AddBooks</title>
    <%
    	int maxBookNo = 0;
    	try {
            

            	ResultSet rs = DB.search("select max(bookno) as booknomax from bookregister", null);
     	        if(rs.next()) {
     	        	maxBookNo = Integer.parseInt(rs.getString("booknomax")) +1 ;
     	        	
     	        }

    		rs.close();

    	}catch (Exception e) {
    		System.err.print("Sorry");
    	}
    %>
</head>
<body>
<div id="addBookDiv" class="page2" style="width: 680px;">
	<form id="addBooksForm" method="post"
		action="${WEB_BASE}AddBooksServlet">
	<div class="error" style="display:none;">
      <img src="${WEB_BASE }images/warning.gif" alt="Warning!" width="24" height="24" style="float:left; margin: -5px 10px 0px 0px; ">

      <span></span>.<br clear="all">
    </div>
		<div id="vwcontainer">
			<table>
				<tr>
					<td>Purchased On Date:</td>
					<td><input type="date" name="date"id ="Purchdate"style="width: 257px" /> </td>
				</tr>
				<tr>
					<td>Accession Number:</td>
					<td><input type="text" name="accno"id ="accno" class="required"
						style="width: 257px;" readonly value="<%=maxBookNo%>"/></td>
				</tr>
								
				<tr>
					<td>Author:</td>
					<td><input type="text" name="author"id ="author" class="required"
						style="width: 257px;" /></td>
				</tr>
				<tr>
					<td>Title:</td>
					<td><input type="text" name="title"id ="tittle" class="required"
						style="width: 257px;" /></td>
				</tr>
				<tr>
					<td>Publisher:</td>
					<td><input type="text" name="pubname"id ="pub" class="required"
						style="width: 257px;" /></td>
				</tr>
				<tr>
					<td>ISBN:</td>
					<td><input type="text" name="isbn"id ="isbn" class="required"
						style="width: 257px;" /></td>
				</tr>
				<tr>
					<td>Subject:</td>
					<td><input type="text" name="subject"id ="subj" class="required"
						style="width: 75px;" /> Class No:</td>
					<td><input type="text" name="classNo"id ="clsno" class="required"
						style="margin-left: -96px; width: 91px;" /></td>
				</tr>
				<tr>
					<td>Edition:</td>
					<td><input type="text" name="edition"id="edition" class="required"
						style="width: 75px;" /> Status:</td>
					<td><input type="text" name="status"id ="status" class="required"
						style="margin-left: -96px; width: 91px;" /></td>
				</tr>
				<tr>
					<td>Year:</td>
					<td><input type="text" name="year" id ="year"class="required"
						style="width: 75px;" /> Pages:</td>
					<td><input type="text" name="pages"id ="pages" class="required"
						style="margin-left: -96px; width: 91px;" /></td>
				</tr>
				<tr>
					<td>Cost:</td>
					<td><input type="text" name="cost"id ="cost" class="required"
						style="width: 75px;" /> Volume:</td>
					<td><input type="text" name="volume"id ="volume" class="required"
						style="margin-left: -96px; width: 91px;" /></td>
				</tr>
				<tr>
					<td>book Source:</td>
					<td><input type="text" name="source"id ="booksrc" class="required"
						style="width: 75px;" /> Bill Number:</td>
					<td><input type="text" name="billno"id ="billno" class="required"
						style="margin-left: -96px; width: 91px;" /></td>
				</tr>
				<tr>
					<td>Additional Info:</td>
					<td><input type="text" name="addi"id ="addinfo" class="required"
						style="width: 257px; height: 57px" /></td>
				</tr>
			</table>
		</div>

		<div id="vwevents" style="margin-left: 380px;">
			<img id="photo" src="${WEB_BASE}images/noimage.jpg" alt="your image" />
			
			
			
			<table>
				<tr>
					<td><input type="file" onchange="readURL(this);" class="vw"/></td>
					<td> </td>
					<td> </td>
				</tr>
				<tr>
					<td><input type="button" value="Remove Pic" class="vw" /></td>
					<td><input type="submit" value="Add New" class="vw" /></td>
					<td><input type="submit" value="Add" class="vw" /></td>
				</tr>
			</table>
			
		          					
		</div>
	</form>
</div>



<jsp:include page="/jsp/footer.jsp" />
</body>
</html>